<?php

namespace app\admin\controller;

use app\common\controller\Admin;
use think\Request;

class Identityname extends Admin
{
   public function index()
   {
       if($this->request->isPost())
       {
           $post = input('post.');
           $arr =[];
           //普通代理-直推
           $ptdl['direct'] = $post['direct'][1];
           $ptdl['id'] = 1;
           //区代理-直推
           $qdl['direct'] = $post['direct'][2];
           //市代理-直推
           $sdl['direct'] = $post['direct'][3];
           //省代理-直推
           $sfdl['direct'] = $post['direct'][4];

           //所需业绩
           //区代理-所需业绩
           $qdl['performance'] = $post['performance'][2];
           //市代理-所需业绩
           $sdl['performance'] = $post['performance'][3];
           //省代理-所需业绩
           $sfdl['performance'] = $post['performance'][4];
           //额外分成
           //区代理-额外分成
           $qdl['division'] = $post['division'][2];
           $qdl['id'] = 2;
           //市代理-额外分成
           $sdl['division'] = $post['division'][3];
           $sdl['id'] = 3;
           //省代理-额外分成
           $sfdl['division'] = $post['division'][4];
           $sfdl['id'] = 4;
           $arr[] = $ptdl;
           $arr[] = $qdl;
           $arr[] = $sdl;
           $arr[] = $sfdl;
           model('identitygong')->saveAll($arr);
       }
       $list = model('identitygong')->select()->toArray();
       $this->assign('list',$list);
       return $this->fetch();
   }
}
